from tortoise import fields
from datetime import datetime
from .base import BaseModel, TimestampMixin


class SysPost(BaseModel, TimestampMixin):
    """岗位信息表"""

    post_id = fields.IntField(pk=True, description="岗位ID")

    post_code = fields.CharField(max_length=64, description="岗位编码")

    post_name = fields.CharField(max_length=50, description="岗位名称")

    post_sort = fields.IntField(description="显示顺序")

    status = fields.CharField(max_length=1, description="状态（0正常 2删除）")

    use_flag = fields.CharField(max_length=1, null=True, description="使用状态（0正常 1停用）")

    create_by = fields.CharField(max_length=64, null=True, description="创建者")

    create_time = fields.DatetimeField(null=True, description="创建时间")

    update_by = fields.CharField(max_length=64, null=True, description="更新者")

    update_time = fields.DatetimeField(null=True, description="更新时间")

    remark = fields.CharField(max_length=500, null=True, description="备注")

    class Meta:
        table = "sys_post"

    def __str__(self):
        return f"{self.post_id}"